<?php
#+------------------------------------------------------------------
#| 普通的。
#+------------------------------------------------------------------
#| Author:Janmas Cromwell <janmas-cromwell@outlook.com>
#+------------------------------------------------------------------
namespace app\library\websocket\logic;

use app\library\redis\Redis;
use app\library\websocket\tool\MessageBuilder;

class Notice
{
    const PREFIX = 'notice_';

    static function create(MessageBuilder $messageBuilder, int $fd)
    {
        $userId = Users::getUserByFd($fd, 'identity');
        $redis = Redis::get();
        $redis->sAdd(self::PREFIX . $userId, strval($messageBuilder));
        Redis::put($redis);
        return true;
    }
}
